<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security4">
    <body th:fragment="navbar" >

  <div class="navbar-wrapper">
    <div class="container">

        <nav class="navbar navbar-inverse navbar-static-top">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" th:href="@{/}" href="#">Apple Store</a>
                </div>
                <div id="navbar" class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                        <li><a th:href="@{/}">Home</a></li>
                        <li><a th:href="@{/product/productList/all}">Products</a></li>
                        <li><a th:href="@{/about}">About Us</a></li>
                    </ul>
                    <ul class="nav navbar-nav pull-right">
                    	
                            <li sec:authorize="isAuthenticated()"><a>Welcome: <span sec:authentication="name">Username</span></a></li>
                            <li sec:authorize="isAuthenticated()"><a id="logout" th:href="@{/logout}">Logout</a></li>
                            <li sec:authorize="hasRole('ROLE_USER')"><a th:href="@{/customer/cart}">Cart</a></li>
                            <li sec:authorize="hasRole('ROLE_ADMIN')"> <a th:href="@{/admin}">Admin</a></li>
                            <li sec:authorize="not isAuthenticated()"><a th:href="@{/login}">Login</a></li>
                            <li sec:authorize="not isAuthenticated()"><a th:href="@{/register}">Register</a></li>
                            
                            <form name="logouForm" id="logouForm" th:action="@{/logout}" method="post" display="none">
                            </form>
                      
                    </ul>
                </div>
            </div>
        </nav>

    </div>
</div>

    </body>
</html>